package interfaceCustomer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class FullSubscriptionPanel extends JPanel implements ActionListener{
	private JButton btnBackToMenu, btnChangeSubType, btnRegister;
	private  JLabel lblCusId, lblCusName,lblAssignTo, lblSubNum, lblValidSince, lblexpierd, lblToalAmount;
	private JTextField txtCusId, txtCusName, txtAssignTo, txtSubNum, txtValidSince, txtexpierd, txtToalAmount;
	private CustomerFrame BackToMenu;
	
	public FullSubscriptionPanel(CustomerFrame _cf){
		
		BackToMenu = _cf;
		this.setLayout(null);
	//	this.this.setBackground(new Color(0,0,0));
			
		btnBackToMenu = new JButton("Back To Menu");
		btnBackToMenu.setBounds(10, 215, 115, 25);
		this.add(btnBackToMenu);
		btnBackToMenu.addActionListener(this);
			
		btnChangeSubType = new JButton("Change Menu Type");
		btnChangeSubType.setBounds(161, 215, 145, 25);
		this.add(btnChangeSubType);
		btnChangeSubType.addActionListener(this);
			
		btnRegister = new JButton("Register");
		btnRegister.setBounds(342, 215, 120, 25);
		this.add(btnRegister);
		btnRegister.addActionListener(this);
			
		lblCusId = new JLabel("Customer ID:");
		lblCusId.setBounds(10, 10, 75, 25);
		this.add(lblCusId);
			
		lblCusName = new JLabel("Customer Name:");
		lblCusName.setBounds(224, 10, 97, 25);
		this.add(lblCusName);
			
		lblAssignTo = new JLabel("Subscription Assigned To Car Number:");
		lblAssignTo.setBounds(10, 40, 232, 25);
		this.add(lblAssignTo);
			
		lblSubNum = new JLabel("Subscription Number:");
		lblSubNum.setBounds(304, 40, 125, 25);
		this.add(lblSubNum);
			
		lblValidSince = new JLabel("Valid Since:");
		lblValidSince.setBounds(10, 73, 70, 25);
		this.add(lblValidSince); 
			
		lblToalAmount = new JLabel("Total Amount:");
		lblToalAmount.setBounds(178, 140, 80, 25);
		this.add(lblToalAmount); 
			
		lblexpierd = new JLabel("Expiration Date:");
		lblexpierd.setBounds(257, 73, 95, 25);
		this.add(lblexpierd); 
			
		txtSubNum = new JTextField();
		txtSubNum.setBounds(433, 42, 60, 20);
		this.add(txtSubNum);
		txtSubNum.setEditable(false);
			
		txtCusId = new JTextField();
		txtCusId.setBounds(90, 12, 120, 20);
		this.add(txtCusId);
		txtCusId.setEditable(false);
			
		txtToalAmount = new JTextField();
		txtToalAmount.setBounds(261, 142, 60, 20);
		this.add(txtToalAmount);
		txtToalAmount.setEditable(false);
			
		txtAssignTo = new JTextField();
		txtAssignTo.setBounds(234, 42, 60, 20);
		this.add(txtAssignTo);
		txtAssignTo.setEditable(false);
			
		txtCusName = new JTextField();
		txtCusName.setBounds(326, 12, 120, 20);
		this.add(txtCusName);
		txtCusName.setEditable(false);
			
		txtValidSince = new JTextField();
		txtValidSince.setBounds(85, 76, 108, 20);
		this.add(txtValidSince);
		Date today=new Date();
	    txtValidSince.setText(today.getDate() + "/" + ((today.getMonth())+1) + "/" + (1900+today.getYear()) + "  " + today.getHours() + ":" + today.getMinutes());  
		txtValidSince.setEditable(false);
						
		txtexpierd = new JTextField();                   
		txtexpierd.setBounds(352, 75, 60, 20);
		this.add(txtexpierd);
		txtexpierd.setEditable(false);
			
		this.setVisible(true);
	}
		@Override
		public void actionPerformed(ActionEvent e) {
			if(e.getSource() == btnChangeSubType) {
				BackToMenu.ChangePanel(3.121);
			}
			if(e.getSource() == btnBackToMenu) {
				BackToMenu.ChangePanel(0);
			}
		}
}
